package com.lyf.boot.listener;

import com.lyf.boot.constant.RabbitMqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 延迟队列
 * @author Luyufan
 * @date 2023/7/10 17:49
 */
@Component
@Slf4j
@RabbitListener(queues = RabbitMqConstant.DELAY_QUEUE)
public class DelayMessageListener {

    @RabbitHandler
    public void receive(String delayMessage){
        log.info("延迟收到消息:{}", delayMessage);
        //throw new RuntimeException("异常测试");
    }
}
